home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Multimedia / Movie3.0 / Source / mpegDecode / gnext.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-05  |  2.6 KB  |  88 lines

  1. /*
  2.  * Copyright (c) 1992 The Regents of the University of California.
  3.  * All rights reserved.
  4.  * 
  5.  * Permission to use, copy, modify, and distribute this software and its
  6.  * documentation for any purpose, without fee, and without written agreement is
  7.  * hereby granted, provided that the above copyright notice and the following
  8.  * two paragraphs appear in all copies of this software.
  9.  * 
  10.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  11.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  12.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14.  * 
  15.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20.  */
  21. #include <math.h>
  22. #include "video.h"
  23. #include "proto.h"
  24. #include "dither.h"
  25.  
  26. /* Range values for lum, cr, cb. */
  27. int LUM_RANGE;
  28. int CR_RANGE;
  29. int CB_RANGE;
  30.  
  31. /* Array that remaps color numbers to actual pixel values used by X server. */
  32.  
  33. unsigned char pixel[256];
  34.  
  35. /* Arrays holding quantized value ranged for lum, cr, and cb. */
  36.  
  37. int *lum_values;
  38. int *cr_values;
  39. int *cb_values;
  40.  
  41.  
  42. /* Array back mapping pixel value to color number. Used for debugging and dumping
  43.    purposes. 
  44. */
  45.  
  46. static char backpixel[256];
  47.  
  48.  
  49.  
  50. /*
  51.  *--------------------------------------------------------------
  52.  *
  53.  * ExecuteDisplay --
  54.  *
  55.  *    Actually displays display plane in previously created window.
  56.  *
  57.  * Results:
  58.  *    None.
  59.  *
  60.  * Side effects:
  61.  *    None.
  62.  *
  63.  *--------------------------------------------------------------
  64.  */
  65.  
  66. /***************************************************************
  67.     vid_stream->current->display is a pointer to a bitmap of dimensions vid_stream->mb_width * 16 
  68.         by vid_stream->mb_height * 16.  The RGB data are three bytes packed into the lower three
  69.         bytes of an int for each pixel. - WAR
  70. ***************************************************************/
  71.  
  72. void ExecuteDisplay(vid_stream)
  73. VidStream *vid_stream;
  74. {
  75.     FILE *fp;
  76.     char outFile[128];
  77.     int iTemp;
  78.  
  79.     totNumFrames++;
  80. #ifdef ANALYSIS
  81.     return;
  82. #endif
  83.     fwrite((void *) &totNumFrames, (size_t) sizeof(int), (size_t) 1, stdout);
  84. #define BYTES_PER_PIXEL 3
  85.     fwrite((void *) vid_stream->current->display, (size_t) sizeof(char), 
  86.             (size_t) (vid_stream->mb_width * 16 * vid_stream->mb_height * 16 * BYTES_PER_PIXEL), stdout);
  87. }
  88.